package com.sodimac.v2s.view.components {

    import com.sodimac.util.controls.adgFooter.FooterAdvancedDataGrid;
    
    import flash.display.Graphics;
    
    import mx.controls.Label;
    import mx.controls.advancedDataGridClasses.AdvancedDataGridListData;

    [Style(name="backgroundColor", type="uint", format="Color", inherit="no")]
    
    public class BackgroundCellColorPrice extends Label {

    override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
	{
	     super.updateDisplayList(unscaledWidth, unscaledHeight);
	 		
	     var g:Graphics = graphics;
	     g.clear();
	     
	     if (data != null)
	     {
			 var grid1:FooterAdvancedDataGrid = FooterAdvancedDataGrid(AdvancedDataGridListData(listData).owner);
			 if ( (grid1.isItemSelected(data) || grid1.isItemHighlighted(data)))
			 {
			  return;	
			 }	    
			 
			 var num1:Number = Number(data.price_vendor);
			 var num2:Number = Number(data.unit_price);
			// trace("precio 1: " + num1+ "  precio 2: " + num2 )
			 var str: String = String(data.problem_name);
			 if ( (str.indexOf("precio") > 0) &&  (num1 != num2) ) 
			 {
			     g.beginFill(0xFF0000);
			     g.drawRect(0, 0, unscaledWidth, unscaledHeight);
			     g.endFill();
			 }
	     }
	     
	}
    }
}
